package com.chuangke.sinotrukbudget.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.chuangke.core.http.HttpResult;
import com.chuangke.core.page.CkPageQuery;
import com.chuangke.sinotrukbudget.model.BudgetAuditControl;
import com.chuangke.sinotrukbudget.service.BudgetAuditControlService;

/**
 * @author chuangke
 * @date 2022-10-20
 */
@Deprecated
@RestController
@RequestMapping("budget/control")
public class BudgetAuditControlController {

	@Autowired
	private BudgetAuditControlService budgetAuditControlService;

	@PreAuthorize("hasAuthority('login:action')")
	@PostMapping(value = "/save")
	public HttpResult save(@RequestBody List<BudgetAuditControl> records) {
		budgetAuditControlService.save(records);
		return HttpResult.ok();
	}

	@PreAuthorize("hasAuthority('login:action')")
	@PostMapping(value = "/delete")
	public HttpResult delete(@RequestBody List<BudgetAuditControl> records) {
		budgetAuditControlService.delete(records);
		return HttpResult.ok();
	}

	@PreAuthorize("hasAuthority('login:action')")
	@GetMapping(value = "/list")
	public HttpResult list() {
		return HttpResult.ok(budgetAuditControlService.findList());
	}
	
	@PreAuthorize("hasAuthority('login:action')")
	@PostMapping(value = "/page")
	public HttpResult page(@RequestBody Map<String,Object> params) {
		return HttpResult.ok(budgetAuditControlService.page(new CkPageQuery(params)));
	}

}
